package com.campus.controller;

import com.campus.service.IActivityService;
import com.campus.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/activity")
public class ActivityController {


    @Autowired
    private IActivityService iActivityService;

    @PostMapping("/create")
    public R create(Integer id, String name, String category, String title, String creator, String abstractInfo, String detailedDesc, Integer status, String picUrls)
    {
        return R.success(iActivityService.creatActivity(id, name, category, title, creator, abstractInfo, detailedDesc, status, picUrls));
    }

    @PutMapping("/update")
    public R update(Integer id, String name, String category, String title, String creator, String abstractInfo, String detailedDesc, Integer status, String picUrls)
    {
        return R.success(iActivityService.updateActivity(id, name, category, title, creator, abstractInfo, detailedDesc, status, picUrls));
    }

    @GetMapping("/query")
    public R query(String status,String name)
    {
        return R.success("查询成功",iActivityService.queryActivity(status,name));
    }
}
